<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2743：[HEOI2012]采花</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[HEOI2012]采花</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[HEOI2012]采花</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [HEOI2012]采花                </h1>
                <p>时间限制：15s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>
<div style="margin: 0cm -1.5pt 0pt 39.2pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">萧芸斓是</span><span style="color: black">Z</span><span style="color: black">国的公主，平时的一大爱好是采花。</span></span></div>
<div style="margin: 0cm 52.35pt 0pt 18pt; line-height: 15.55pt"><span style="font-size: medium"><span style="color: black">今天天气晴朗，阳光明媚，公主清晨便去了皇宫中新建的花园采花。花园足够大，容纳</span><span style="color: black">了</span><span style="color: black">n</span><span style="color: black">朵花，花有</span><span style="color: black">c</span><span style="color: black">种颜色（用整数</span><span style="color: black">1-c</span><span style="color: black">表示），且花是排成一排的，以便于公主采花。</span><span style="color: black">公主每次采花后会统计采到的花的颜色数，颜色数越多她会越高兴！同时，她有一癖好，</span><span style="color: black">她不允许最后自己采到的花中，某一颜色的花只有一朵。为此，公主每采一朵花，要么此前</span><span style="color: black">已采到此颜色的花，要么有相当正确的直觉告诉她，她必能再次采到此颜色的花。</span><span style="color: black">由于时间关系，公主只能走过花园连续的一段进行采花，便让女仆福涵洁安排行程。福</span><span style="color: black">涵洁综合各种因素拟定了</span><span style="color: black">m</span><span style="color: black">个行程，然后一一向你询问公主能采到多少朵花（她知道你是编</span><span style="color: black">程高手，定能快速给出答案！），最后会选择令公主最高兴的行程（为了拿到更多奖金！）。</span></span></div>
</div></p><hr/><h3>输入格式</h3><p><p><span style="font-size: medium"><br clear="all" />
</span></p>
<div style="margin: 0cm 47.15pt 0pt 18pt; line-height: 15.35pt" align="left"><span style="font-size: medium">&nbsp;<span style="color: black">第一行四个空格隔开的整数</span><span style="color: black">n</span><span style="color: black">、</span><span style="color: black">c</span><span style="color: black">以及</span><span style="color: black">m</span><span style="color: black">。</span><span style="color: black">接下来一行</span><span style="color: black">n</span><span style="color: black">个空格隔开的整数，每个数在</span><span style="color: black">[1, c]</span><span style="color: black">间，第</span><span style="color: black">i</span><span style="color: black">个数表示第</span><span style="color: black">i</span><span style="color: black">朵花的颜色。</span><span style="color: black">接下来</span><span style="color: black">m</span><span style="color: black">行每行两个空格隔开的整数</span><span style="color: black">l</span><span style="color: black">和</span><span style="color: black">r</span><span style="color: black">（</span><span style="color: black">l </span><span style="color: black">&le;</span><span style="color: black"> r</span><span style="color: black">），表示女仆安排的行程为公主经</span><span style="color: black">过第</span><span style="color: black">l</span><span style="color: black">到第</span><span style="color: black">r</span><span style="color: black">朵花进行采花。</span></span></div></p><hr/><h3>输出格式</h3><p><div style="margin: 0cm -1.5pt 0pt 18pt; line-height: 15.75pt" align="left">&nbsp;</div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black; letter-spacing: 0.2pt">共</span><span style="color: black; letter-spacing: 0.2pt">m</span><span style="color: black; letter-spacing: 0.2pt">行，每行一个整数，第</span><span style="color: black; letter-spacing: 0.2pt">i</span><span style="color: black; letter-spacing: 0.2pt">个数表示公主在女仆的第</span><span style="color: black; letter-spacing: 0.2pt">i</span><span style="color: black; letter-spacing: 0.2pt">个行程中能采到的花的颜色数。</span></span></div></p><hr/><h3>样例输入</h3><pre>5  3 5
1  2 2 3 1
1  5
1  2
2  2
2  3
3  5
</pre><hr/><h3>样例输出</h3><pre>2 
0 0 1 0 
【样例说明】
询问[1, 5]：公主采颜色为1和2的花，由于颜色3的花只有一朵，公主不采；询问[1, 2]：颜色1和颜色2的花均只有一朵，公主不采；
询问[2, 2]：颜色2的花只有一朵，公主不采；
询问[2, 3]：由于颜色2的花有两朵，公主采颜色2的花；
询问[3, 5]：颜色1、2、3的花各一朵，公主不采。
</pre><hr/><h3>提示</h3><p><p>【数据范围】<br />
对于100%的数据，1 &le; n &le;&nbsp;&nbsp;&nbsp; 10^6，c &le; n，m &le;10^6。</p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2743" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2743" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>